1
2 import java.sql.Connection;
3 import java.sql.DriverManager;
4 import java.sql.ResultSet;
5 import java.sql.Statement;
6 import java.text.SimpleDateFormat;
7 import java.util.Date;

8
9
10 /*
11  * To change
this license header, choose License Headers in Project Properties.
12  * To change
this template file, choose Tools | Templates
13  * and open the template
in the editor.
14  */
15
16 /**
17  *
18  * @author MY LAPI
19  */

20
21
22
23 public
class UserDesh extends javax.swing.JFrame {
24
25     
/**
26      * Creates
new form UserDesh
27      */

28     
public UserDesh(int uid) {
29         initComponents();
30         
31         
32         
try{
33             Class.forName(
"com.mysql.jdbc.Driver").newInstance();
34             Connection cn=DriverManager.getConnection(
"jdbc:mysql://localhost:3306/bank","root","");
35             SimpleDateFormat formatter =
new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
36             Date date =
new Date();
37         jLabel4.setText(formatter.format(date));
38             Statement smt=cn.createStatement();
39             ResultSet rs=smt.executeQuery(
"select * from user where uid='"+uid+"'");
40             
41      
42
43             
44             
if(rs.next()){
45                     jLabel2.setText(rs.getString(
2));
46                         jLabel3.setText(rs.getString(
3));
47             }
else{
48                 
49             }
50         }
catch(Exception e){}
51     }
52
53     
private UserDesh() {
54         
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
55     }
56
57     
/**
58      * This method
is called from within the constructor to initialize the form.
59      * WARNING: Do NOT modify
this code. The content of this method is always
60      * regenerated
by the Form Editor.
61      */

62     @SuppressWarnings(
"unchecked")
63     
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
64     
private void initComponents() {
65
66         jPanel1 =
new javax.swing.JPanel();
67         jLabel1 =
new javax.swing.JLabel();
68         jButton1 =
new javax.swing.JButton();
69         jLabel2 =
new javax.swing.JLabel();
70         jLabel3 =
new javax.swing.JLabel();
71         jButton2 =
new javax.swing.JButton();
72         jButton3 =
new javax.swing.JButton();
73         jLabel4 =
new javax.swing.JLabel();
74         jButton4 =
new javax.swing.JButton();
75         jButton7 =
new javax.swing.JButton();
76         jButton8 =
new javax.swing.JButton();
77         jButton9 =
new javax.swing.JButton();
78         jButton10 =
new javax.swing.JButton();
79         jButton11 =
new javax.swing.JButton();
80         jButton12 =
new javax.swing.JButton();
81
82         setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
83
84         jPanel1.setBackground(
new java.awt.Color(204, 255, 204));
85
86         jLabel1.setFont(
new java.awt.Font("Arial Unicode MS", 0, 24)); // NOI18N
87         jLabel1.setText(
"WelCome To STAR BANK");
88
89         javax.swing.GroupLayout jPanel1Layout =
new javax.swing.GroupLayout(jPanel1);
90         jPanel1.setLayout(jPanel1Layout);
91         jPanel1Layout.setHorizontalGroup(
92             jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
93             .addGroup(jPanel1Layout.createSequentialGroup()
94                 .addGap(
72, 72, 72)
95                 .addComponent(jLabel1)
96                 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
97         );
98         jPanel1Layout.setVerticalGroup(
99             jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
100             .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
101                 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
102                 .addComponent(jLabel1)
103                 .addContainerGap())
104         );
105
106         jButton1.setText(
"LogOut");
107         jButton1.addActionListener(
new java.awt.event.ActionListener() {
108             
public void actionPerformed(java.awt.event.ActionEvent evt) {
109                 jButton1ActionPerformed(evt);
110             }
111         });
112
113         jLabel2.setFont(
new java.awt.Font("Arial Unicode MS", 0, 16)); // NOI18N
114
115         jLabel3.setFont(
new java.awt.Font("Arial Unicode MS", 0, 16)); // NOI18N
116
117         jButton2.setText(
"My Account");
118         jButton2.addActionListener(
new java.awt.event.ActionListener() {
119             
public void actionPerformed(java.awt.event.ActionEvent evt) {
120                 jButton2ActionPerformed(evt);
121             }
122         });
123
124         jButton3.setText(
"Transition History");
125
126         jLabel4.setFont(
new java.awt.Font("Arial Unicode MS", 0, 16)); // NOI18N
127
128         jButton4.setText(
"Transfer");
129
130         jButton7.setText(
"Requests");
131         jButton7.addActionListener(
new java.awt.event.ActionListener() {
132             
public void actionPerformed(java.awt.event.ActionEvent evt) {
133                 jButton7ActionPerformed(evt);
134             }
135         });
136
137         jButton8.setText(
"Services");
138
139         jButton9.setText(
"Quick Transfer");
140
141         jButton10.setText(
"Top Up & Recharge");
142         jButton10.addActionListener(
new java.awt.event.ActionListener() {
143             
public void actionPerformed(java.awt.event.ActionEvent evt) {
144                 jButton10ActionPerformed(evt);
145             }
146         });
147
148         jButton11.setText(
" Bill Payments");
149
150         jButton12.setText(
"Debit card Service");
151
152         javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(getContentPane());
153         getContentPane().setLayout(layout);
154         layout.setHorizontalGroup(
155             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
156             .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
157             .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
158                 .addContainerGap()
159                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
160                     .addGroup(layout.createSequentialGroup()
161                         .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
162                             .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
163                                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
164                                     .addComponent(jButton2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
165                                     .addComponent(jButton10, javax.swing.GroupLayout.DEFAULT_SIZE,
146, Short.MAX_VALUE))
166                                 .addGap(
10, 10, 10)
167                                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
false)
168                                     .addGroup(layout.createSequentialGroup()
169                                         .addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE,
147, javax.swing.GroupLayout.PREFERRED_SIZE)
170                                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
171                                         .addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE,
152, javax.swing.GroupLayout.PREFERRED_SIZE))
172                                     .addGroup(layout.createSequentialGroup()
173                                         .addComponent(jButton11, javax.swing.GroupLayout.PREFERRED_SIZE,
147, javax.swing.GroupLayout.PREFERRED_SIZE)
174                                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
175                                         .addComponent(jButton12, javax.swing.GroupLayout.PREFERRED_SIZE,
152, javax.swing.GroupLayout.PREFERRED_SIZE))))
176                             .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
177                                 .addComponent(jButton7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
178                                 .addGap(
10, 10, 10)
179                                 .addComponent(jButton8, javax.swing.GroupLayout.PREFERRED_SIZE,
147, javax.swing.GroupLayout.PREFERRED_SIZE)
180                                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
181                                 .addComponent(jButton9, javax.swing.GroupLayout.PREFERRED_SIZE,
152, javax.swing.GroupLayout.PREFERRED_SIZE)))
182                         .addContainerGap())
183                     .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
184                         .addGap(
0, 0, Short.MAX_VALUE)
185                         .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
186                             .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
187                                 .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE,
207, javax.swing.GroupLayout.PREFERRED_SIZE)
188                                 .addGap(
23, 23, 23))
189                             .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
190                                 .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE,
154, javax.swing.GroupLayout.PREFERRED_SIZE)
191                                 .addGap(
18, 18, 18)
192                                 .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE,
153, javax.swing.GroupLayout.PREFERRED_SIZE)
193                                 .addGap(
22, 22, 22)
194                                 .addComponent(jButton1)
195                                 .addContainerGap())))))
196         );
197         layout.setVerticalGroup(
198             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
199             .addGroup(layout.createSequentialGroup()
200                 .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
201                 .addGap(
12, 12, 12)
202                 .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE,
21, javax.swing.GroupLayout.PREFERRED_SIZE)
203                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
204                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
205                     .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE,
23, javax.swing.GroupLayout.PREFERRED_SIZE)
206                     .addComponent(jButton1)
207                     .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE,
23, javax.swing.GroupLayout.PREFERRED_SIZE))
208                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
39, Short.MAX_VALUE)
209                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
210                     .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE,
82, javax.swing.GroupLayout.PREFERRED_SIZE)
211                     .addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE,
82, javax.swing.GroupLayout.PREFERRED_SIZE)
212                     .addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE,
82, javax.swing.GroupLayout.PREFERRED_SIZE))
213                 .addGap(
18, 18, 18)
214                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
215                     .addComponent(jButton11, javax.swing.GroupLayout.PREFERRED_SIZE,
82, javax.swing.GroupLayout.PREFERRED_SIZE)
216                     .addComponent(jButton12, javax.swing.GroupLayout.PREFERRED_SIZE,
82, javax.swing.GroupLayout.PREFERRED_SIZE)
217                     .addComponent(jButton10, javax.swing.GroupLayout.PREFERRED_SIZE,
82, javax.swing.GroupLayout.PREFERRED_SIZE))
218                 .addGap(
18, 18, 18)
219                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
220                     .addComponent(jButton9, javax.swing.GroupLayout.PREFERRED_SIZE,
82, javax.swing.GroupLayout.PREFERRED_SIZE)
221                     .addComponent(jButton8, javax.swing.GroupLayout.PREFERRED_SIZE,
82, javax.swing.GroupLayout.PREFERRED_SIZE)
222                     .addComponent(jButton7, javax.swing.GroupLayout.PREFERRED_SIZE,
82, javax.swing.GroupLayout.PREFERRED_SIZE))
223                 .addGap(
18, 18, 18))
224         );
225
226         pack();
227     }
// </editor-fold>//GEN-END:initComponents
228
229     
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
230         System.exit(
0);
231     }
//GEN-LAST:event_jButton1ActionPerformed
232
233     
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
234         
// TODO add your handling code here:
235     }
//GEN-LAST:event_jButton2ActionPerformed
236
237     
private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed
238         
// TODO add your handling code here:
239     }
//GEN-LAST:event_jButton7ActionPerformed
240
241     
private void jButton10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton10ActionPerformed
242         
// TODO add your handling code here:
243     }
//GEN-LAST:event_jButton10ActionPerformed
244
245     
/**
246      * @param args the command line arguments
247      */

248     
public static void main(String args[]) {
249         
/* Set the Nimbus look and feel */
250         
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
251         
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
252          * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
253          */

254         
try {
255             
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
256                 
if ("Nimbus".equals(info.getName())) {
257                     javax.swing.UIManager.setLookAndFeel(info.getClassName());
258                     
break;
259                 }
260             }
261         }
catch (ClassNotFoundException ex) {
262             java.util.logging.Logger.getLogger(UserDesh.
class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
263         }
catch (InstantiationException ex) {
264             java.util.logging.Logger.getLogger(UserDesh.
class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
265         }
catch (IllegalAccessException ex) {
266             java.util.logging.Logger.getLogger(UserDesh.
class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
267         }
catch (javax.swing.UnsupportedLookAndFeelException ex) {
268             java.util.logging.Logger.getLogger(UserDesh.
class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
269         }
270         
//</editor-fold>
271
272         
/* Create and display the form */
273         java.awt.EventQueue.invokeLater(
new Runnable() {
274             
public void run() {
275                 
new UserDesh().setVisible(true);
276                 
277                 
278             }
279         });
280     }
281
282     
// Variables declaration - do not modify//GEN-BEGIN:variables
283     
private javax.swing.JButton jButton1;
284     
private javax.swing.JButton jButton10;
285     
private javax.swing.JButton jButton11;
286     
private javax.swing.JButton jButton12;
287     
private javax.swing.JButton jButton2;
288     
private javax.swing.JButton jButton3;
289     
private javax.swing.JButton jButton4;
290     
private javax.swing.JButton jButton7;
291     
private javax.swing.JButton jButton8;
292     
private javax.swing.JButton jButton9;
293     
private javax.swing.JLabel jLabel1;
294     
private javax.swing.JLabel jLabel2;
295     
private javax.swing.JLabel jLabel3;
296     
private javax.swing.JLabel jLabel4;
297     
private javax.swing.JPanel jPanel1;
298     
// End of variables declaration//GEN-END:variables
299 }


Gõ tìm kiếm nhanh...